'use strict';
let textCodeEl = document.querySelector('.text-code');
let executeButEl = document.querySelector('.execute-code');
let outputEl = document.querySelector('.output');

let log = v => {
	outputEl.innerText += (JSON.stringify(v, null, '\t') || 'undefined') + '\n';
	outputEl.scrollTop = outputEl.scrollHeight;
};

// window.onclick = e => {
// 	console.log(e.path);
// 	window.onclick = null;
// };

class Brick extends EventEmitter {
	constructor() {
		super();
	}
	
	static width = 120;
	static height = 250;
	static thickness = 65;
};


let useAPI = {
	g: {},
	
	Brick, log,
	
	Vector2, vec2, VectorN, vecN, EventEmitter, random, JSONcopy,
	Promise, Proxy, WeakRef,
	console, Date, Math, JSON, Set, Map, WeakSet, WeakMap,
	Object, Array, Function, Number, String, RegExp, BigInt, Symbol
};
useAPI.global = useAPI;

textCodeEl.value = 'Brick.width * 4';

executeButEl.onclick = e => {
	codeShell(`log(${textCodeEl.value})`, useAPI).call(useAPI);
};
